package org.javaboy.fmall.controller.generateTableToField;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Param;
import org.javaboy.fmall.service.generateTableToFieldService.TableGenerateService;
import org.javaboy.fmall.utils.returnTool.ResTool;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

import java.sql.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 根据表生成字段，插入到数据库
 *
 * @ClassName TableGenerateController
 * @Description
 * @Author find me
 * @Date 2020/7/18 0018 16:34
 * @Version 1.0
 */
@Api(description = "根据表生成字段，插入到数据库")
@RestController
@RequestMapping("/TableGenerate")
public class TableGenerateController {


    @Autowired
    private TableGenerateService tableGenerateService;

    @ApiOperation(value = "查询数据库全部的表", notes = "查询数据库全部的表")
    @GetMapping("/test")
//    @ApiImplicitParams(
////            @ApiImplicitParam(name = "tableName",value = "表名字")
//    )
    @ResponseBody
    public ResTool getGenerateAllTable( @RequestParam("tableName")    ArrayList<String> tableName) {
        List<JSONObject> generateAllTable = tableGenerateService.getGenerateAllTable(tableName);
        return ResTool.build().data(generateAllTable);
    }



}
